package org.example.day03;

/**
 * 修饰静态方法练习
 **/
public class MyThread11 {
    public static void main(String[] args) {
        MyThread11 m11 = new MyThread11();
        new Thread(new Runnable() {
            @Override
            public void run() {
                m11.print();
            }
        }).start();
        new Thread(new Runnable() {
            @Override
            public void run() {
                MyThread11.show();
            }
        }).start();
    }
    public void print(){
        synchronized (this){
            for (int i = 0; i < 10000; i++) {
                System.out.println(Thread.currentThread().getName() + "**" + i);
            }
        }
    }
    public synchronized static void show(){
        for (int i = 0; i < 10000; i++) {
            System.out.println(Thread.currentThread().getName() + "--" + i);
        }
    }
}
